A good answer might be:

No. It is plausible that they could be, but it turns out that leading spaces will spoil what is otherwise a fine integer.


Another Example

Here is another example, suitable for "copy-paste-and-run." It asks the user for two integers which are to be added together.

import java.io.*;
class AddTwo
{
  public static void main (String[] args) throws IOException
  { 
    BufferedReader stdin = 
        new BufferedReader ( new InputStreamReader( System.in ) );
 
    String line1, line2;                          // declaration of input Strings
    int    first, second, sum ;                   // declaration of int variables

    System.out.println("Enter first  integer:");
    line1   = stdin.readLine();
    first   = Integer.parseInt( line1 );          // convert line1 to first int

    System.out.println("Enter second integer:");
    line2   = stdin.readLine();
    second  = Integer.parseInt( line2 );          // convert line2 to second int

    sum     = first + second;                     // add the two ints, put result in sum

    System.out.println("The sum of " + 
        first + " plus " + second +" is " + sum );
  }
}

Study the program for a while. Notice how the indenting and blank lines help in displaying how the program is organized. Here is a sample run of the program:

Enter first  integer:
12
Enter second integer:
-8
The sum of 12 plus -8 is 4

QUESTION 18:

A slightly hard question: Write the last statement of the program (the one that does output) without using either of the variables first or second. The output should look the same as before.